package com.ruoyi.system.domain.summary;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * Created On : 2024/4/6.
 * Author : xuliang
 * Description: ProjectSummary
 * <p>
 */
@Data
@ToString
public class ProjectSummary {

    @ExcelIgnore
    private long id;

    @ExcelIgnore
    private String projectCode;

    @ExcelIgnore
    private Integer areaId;

    @ExcelProperty(value = {"序号","序号"})
    @ColumnWidth(8)
    private long no;

    @ExcelProperty(value = {"项目名称","项目名称"})
    @ColumnWidth(20)
    private String projectName;

    @ExcelProperty(value = {"合同总价款","合同总价款"})
    @ColumnWidth(10)
    private BigDecimal totalContract;

    @ExcelProperty(value = {"内部考核利润率","内部考核利润率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double assessRate;

    @ExcelProperty(value = {"预计总成本","预计总成本"})
    @ColumnWidth(10)
    private BigDecimal expectCost;

    @ExcelProperty(value = {"开累合计 除税（万元）","累计完工产值"})
    @ColumnWidth(10)
    private BigDecimal totalOutput;

    @ExcelProperty(value = {"开累合计 除税（万元）","累计完工成本"})
    @ColumnWidth(10)
    private BigDecimal totalCost;

    @ExcelProperty(value = {"开累合计 除税（万元）","累计实现利润"})
    @ColumnWidth(10)
    private BigDecimal totalProfit;

    @ExcelProperty(value = {"开累合计 除税（万元）","利润率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double totalProfitRate;

    @ExcelProperty(value = {"开累合计 除税（万元）","累计完工百分比"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double totalProcessRate;

    @ExcelProperty(value = {"其中完工成本中包含","财务利息"})
    @ColumnWidth(10)
    private BigDecimal interest;

    @ExcelProperty(value = {"其中完工成本中包含","其他费用"})
    @ColumnWidth(10)
    private BigDecimal other;

    @ExcelProperty(value = {"截止去年12月（万元）","完工产值"})
    @ColumnWidth(10)
    private BigDecimal lastYearOutput;

    @ExcelProperty(value = {"截止去年12月（万元）","完工成本"})
    @ColumnWidth(10)
    private BigDecimal lastYearCost;

    @ExcelProperty(value = {"截止去年12月（万元）","实现利润"})
    @ColumnWidth(10)
    private BigDecimal lastYearProfit;

    @ExcelProperty(value = {"截止去年12月（万元）","利润率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double lastYearProfitRate;

    @ExcelProperty(value = {"今年（万元）","完工产值"})
    @ColumnWidth(10)
    private BigDecimal thisYearOutput;

    @ExcelProperty(value = {"今年（万元）","完工成本"})
    @ColumnWidth(10)
    private BigDecimal thisYearCost;

    @ExcelProperty(value = {"今年（万元）","实现利润"})
    @ColumnWidth(10)
    private BigDecimal thisYearProfit;

    @ExcelProperty(value = {"今年（万元）","利润率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double thisYearProfitRate;

    @ExcelProperty(value = {"截止12月底应收账款","截止12月底应收账款"})
    @ColumnWidth(10)
    private BigDecimal receivable;

    @ExcelProperty(value = {"截止12月底实收账款","截止12月底实收账款"})
    @ColumnWidth(10)
    private BigDecimal received;

    @ExcelProperty(value = {"截止12月底欠收账款","截止12月底欠收账款"})
    @ColumnWidth(10)
    private BigDecimal arrears;

    @ExcelProperty(value = {"回款率","回款率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double paymentRate;

    @ExcelProperty(value = {"截止12月底应付账款","截止12月底应付账款"})
    @ColumnWidth(10)
    private BigDecimal payable;

    @ExcelProperty(value = {"截止12月底已付账款","截止12月底已付账款"})
    @ColumnWidth(10)
    private BigDecimal paid;

    @ExcelProperty(value = {"截止12月底未付账款","截止12月底未付账款"})
    @ColumnWidth(10)
    private BigDecimal unpaid;

    @ExcelProperty(value = {"资金利用率","资金利用率"})
    @ColumnWidth(8)
    @NumberFormat(value = "0.00%")
    private Double useRate;

    @ExcelIgnore
    private Integer number;

    private String getLastYear() {
        return "截止" + String.valueOf(LocalDate.now().minusYears(1).getYear()) + "年12月（万元）";
    }

    private String getThisYearMonth() {
        return String.valueOf(LocalDate.now());
    }

}
